/**
 * 
 */
package com.mes.check.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.BatchSize;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.context.annotation.Lazy;

import com.mes.basicdata.domain.Dept;
import com.mes.basicdata.domain.Employee;
import com.mes.basicdata.domain.Partner;
import com.mes.basicdata.domain.TypesData;
import com.mes.check.domain.Repair;
import com.mes.common.domain.BasicModel;
import com.mes.task.domain.PartTask;

/**
* <p>
* 合格证，所有类型合格证的父类
* </p>
*/

@Entity()
@Table(name = "M_CERTIFICATE")
@BatchSize(size=20)
@Lazy(value=true)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Certificate extends BasicModel implements java.io.Serializable {
	
	public static final int CERTIFICATE_STATE_DRAFT = 9; // 草稿
	public static final int CERTIFICATE_STATE_EFFECTIVE = 10; // 已生效
	public static final int CERTIFICATE_STATE_REJECTED = 15; // 已作废

	/**
	 * 合格证唯一号
	 */
	@Id
	@GenericGenerator(name = "uniqueId", strategy = "assigned")
	@Column(name="CERTIFICATEUID")
	protected String uniqueId;


	/**
	 * 复杂对象映射--RepairHeader
	 */
	@Column(name="REPAIRUID",length=50)
	protected String repairUid;
	
	@ForeignKey(name = "null")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "REPAIRUID", insertable = false, updatable = false)
	protected Repair repair;

	@Column(name="MATERIALREPUID",length=50)
	protected String materialRepUid;
	@Column(name="SOURCEBATCHNUM",length=50)
	protected String sourceBatchNum;

	/**
	 * 附件编号
	 */
	@Column(name="ATTATCHREF",length=50)
	protected String attatchRef;

	@Column(name="CERTIFICATEID",length=50)
	protected String certificateId;

	/**
	 * 类型与状态映射--certificateState
	 */
	@Column(name="CERTIFICATESTATE",length=50)
	protected Integer certificateState;
	@Transient
	protected TypesData certificateStateDesc;

	@Column(name="CUSTOMERCHECKED",length=50)
	protected Boolean customerChecked;

	/**
	 * 复杂对象映射--Employee
	 */
	@Column(name="CHECKER",length=50)
	protected String checkerUid;
	
	@ForeignKey(name = "null")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CHECKER", insertable = false, updatable = false)
	protected Employee checker;

	@Column(name="CHECKTIME",length=50)
	protected Date checkTime;

	/**
	 * 复杂对象映射--Task
	 */
	@Column(name="TASKUID",length=50)
	protected String taskUid;
	
	@ForeignKey(name = "null")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "TASKUID", insertable = false, updatable = false)
	protected PartTask partTask;

	@Column(name="CERTIFICATEQTY",length=50)
	protected Long certificateQty;
	
	@Column(name="MATERIALSNS",length=50)
	protected String materialSns;

	/**
	 * 复杂对象映射--Dept
	 */
	@Column(name="DEPTID",length=50)
	protected String deptUid;
	
	@ForeignKey(name = "null")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "DEPTID", insertable = false, updatable = false)
	protected Dept dept;

	@Column(name="CHECKERPRINT",length=50)
	protected String checkerPrint;
	
	@Column(name="INTOWAREHOUSEDATE",length=50)
	protected Date intoWarehouseDate;
	
	@Column(name="PARTSTYLE",length=50)
	protected String partStyle;

	@Column(name="PRODUCT_PHASE",length=50)
	protected String productPhase;
	
	@Column(name="MODEL",length=50)
	protected String model;
	
	@Column(name="DRAWINGID",length=50)
	protected String drawingId;
	
	@Column(name="BATCHNUM",length=50)
	protected String batchNum;
	
	@Column(name="PART_NAME",length=50)
	protected String partName;
	
	@Column(name="DEPTNAME",length=50)
	protected String deptName;
	
	@Column(name="CHANGEREASON",length=50)
	protected String changeReason;
	
	@Column(name="REPRINT_ALLOW",length=50)
	protected Boolean reprintAllow;
	
	@Column(name="PRODUCT_VERSION",length=50)
	protected String productVersion;

	@Column(name="CUSTOMER",length=50)
	protected String customerUid;
//	@ForeignKey(name = "null")
//	@ManyToOne(fetch = FetchType.LAZY)
//	@JoinColumn(name = "CUSTOMER", insertable = false, updatable = false)
//	protected Partner customer;

	@Column(name="MATERIAL_BATCHNUM",length=50)
	protected String materialBatchNum;

	@Column(name="TECHNICALBILLID",length=50)
	protected String technicalBillId;

	/**
	 * 检验部门名称
	 */
	@Column(name="CHECKDEPTNAME",length=50)
	protected String checkDeptName;

	/**
	 * 材料供应状态
	 */
	@Column(name="SUPPLYSTATE",length=50)
	protected String supplyState;

	/**
	 * 检验部门编号
	 */
	@Column(name="CHECKDEPTID",length=50)
	protected String checkDeptUid;

	/*
	 * 技术标准编号
	 */
	@Column(name="TECHSTANDARDID",length=50)
	protected String techStandardId;

	/*
	 * 理化试验结果，这个属垃圾字段
	 */
	@Column(name="PCCHECKRESULT",length=50)
	protected String pcCheckResult;

	@Column(name="CERTIFICATETYPE",length=50)
	protected String certificateType;

	@Column(name="REPLACEMATERIAL",length=50)
	protected String replaceMaterial;

	/**
	 * 检验员名称
	 */
	@Column(name="CHECKERNAME",length=50)
	protected String checkerName;

	/**
	 * 产品版次
	 */
	@Column(name="PRODUCT_ISSUE",length=50)
	protected String productIssue;

	/**
	 * 技术条件
	 */
	@Column(name="TECH_CONDITION",length=50)
	protected String techCondition;
	/**
	 * 客户代表
	 */
	@Column(name="CUSTOMER_REPRESENT",length=50)
	protected String customerRepresent;
	/*
	 * 上次打印日期
	 */
	@Column(name="LASTPRINT",length=50)
	protected Date lastPrintTime;
	@Column(name="USE_STATE",length=50)
	protected String useState;
	@Column(name="SUB_MATERIALREPUID",length=50)
	protected String subMaterialRepUid;
	@Column(name="DESIGN_REPLACE_BILLNUMBER",length=50)
	protected String designReplaceBillNumber;
	@Column(name="PART_NUMBER",length=50)
	protected String partUid;
	
	@Column(name="TECH_VERSION",length=50)
	protected String techVersion; //工艺版次
	@Column(name="PARTSTYLE_STANDARD",length=50)
	protected String partstyleStandard; //原材料标准
	@Column(name="PLAN_QTY",length=50)
	protected Long planQty; //投入数量
	@Column(name="SUBMIT_CHECK_QTY",length=50)
	protected Long submitCheckQty; //交检数量
	@Column(name="FIRST_CHECK_GOOD_QTY",length=50)
	protected Long firstCheckGoodQty; //一次交检合格数量
	@Column(name="COCHECKER_PRINT",length=50)
	protected String coCheckerPrint; //协作检验员印章
	@Column(name="CONTACT_ID",length=50)
	protected String contactId; //联络单号
	
	// Constructors

	/**
	 * 空的构造方法。
	 */
	public Certificate() {
	}

	/**
	 * 获取让步单号。
	 * 
	 * @return the repairUid
	 */
	
	public String getRepairUid() {
		return repairUid;
	}

	/**
	 * 设置让步单号。
	 * 
	 * @param repairUid
	 *            the repairUid to set
	 */
	public void setRepairUid(String repairUid) {
		this.repairUid = repairUid;
	}

	/**
	 * 获取代料单号。
	 * 
	 * @return the materialRepUid
	 */
	
	public String getMaterialRepUid() {
		return materialRepUid;
	}

	/**
	 * 设置待料单号。
	 * 
	 * @param materialRepUid
	 *            the materialRepUid to set
	 */
	public void setMaterialRepUid(String materialRepUid) {
		this.materialRepUid = materialRepUid;
	}

	/**
	 * 获取零（组）件号。
	 * 
	 * @return the sourceBatchNum
	 */
	
	public String getSourceBatchNum() {
		return sourceBatchNum;
	}

	/**
	 * 设置零（组）件号。
	 * 
	 * @param sourceBatchNum
	 *            the sourceBatchNum to set
	 */
	public void setSourceBatchNum(String sourceBatchNum) {
		this.sourceBatchNum = sourceBatchNum;
	}

	/**
	 * 获取合格证号。
	 * 
	 * @return the certificateId
	 */
	
	public String getCertificateId() {
		return certificateId;
	}

	/**
	 * 设置合格证号。
	 * 
	 * @param certificateId
	 *            the certificateId to set
	 */
	public void setCertificateId(String certificateId) {
		this.certificateId = certificateId;
	}

	/**
	 * 获取合格证状态。
	 * 
	 * @return the certificateState
	 */
	
	public Integer getCertificateState() {
		return certificateState;
	}

	/**
	 * 设置合格证状态。
	 * 
	 * @param certificateState
	 *            the certificateState to set
	 */
	public void setCertificateState(Integer certificateState) {
		this.certificateState = certificateState;
	}

	/**
	 * 获取合格证状态描述。
	 * 
	 * @return the certificateStateDesc
	 */
	public TypesData getCertificateStateDesc() {
		return certificateStateDesc;
	}

	/**
	 * 设置合格证状态描述。
	 * 
	 * @param certificateStateDesc
	 *            the certificateStateDesc to set
	 */
	public void setCertificateStateDesc(TypesData certificateStateDesc) {
		this.certificateStateDesc = certificateStateDesc;
	}

	/**
	 * 获取客户代表。
	 * 
	 * @return the customerChecked
	 */
	
	public Boolean getCustomerChecked() {
		return customerChecked;
	}

	/**
	 * 设置客户代表。
	 * 
	 * @param customerChecked
	 *            the customerChecked to set
	 */
	public void setCustomerChecked(Boolean customerChecked) {
		this.customerChecked = customerChecked;
	}

	/**
	 * 获取检验员编号。
	 * 
	 * @return the checkerUid
	 */
	
	public String getCheckerUid() {
		return checkerUid;
	}

	/**
	 * 设置检验员编号。
	 * 
	 * @param checkerUid
	 *            the checkerUid to set
	 */
	public void setCheckerUid(String checkerUid) {
		this.checkerUid = checkerUid;
	}

	/**
	 * 获取检验员。
	 * 
	 * @return the checker
	 */
	public Employee getChecker() {
		return checker;
	}

	/**
	 * 设置检验员。
	 * 
	 * @param checker
	 *            the checker to set
	 */
	public void setChecker(Employee checker) {
		this.checker = checker;
	}

	/**
	 * 获取检验时间。
	 * 
	 * @return the checkTime
	 */
	
	public Date getCheckTime() {
		return checkTime;
	}

	/**
	 * 设置检验时间。
	 * 
	 * @param checkTime
	 *            the checkTime to set
	 */
	public void setCheckTime(Date checkTime) {
		this.checkTime = checkTime;
	}

	/**
	 * 获取任务编号。
	 * 
	 * @return the taskUid
	 */
	
	public String getTaskUid() {
		return taskUid;
	}

	/**
	 * 设置任务编号。
	 * 
	 * @param taskUid
	 *            the taskUid to set
	 */
	public void setTaskUid(String taskUid) {
		this.taskUid = taskUid;
	}

	/**
	 * 获取合格证数量。
	 * 
	 * @return the certificateQty
	 */
	
	public Long getCertificateQty() {
		return certificateQty;
	}

	/**
	 * 设置合格证数量。
	 * 
	 * @param certificateQty
	 *            the certificateQty to set
	 */
	public void setCertificateQty(Long certificateQty) {
		this.certificateQty = certificateQty;
	}

	/**
	 * 获取单个零件序列号。
	 * 
	 * @return the materialSns
	 */
	
	public String getMaterialSns() {
		return materialSns;
	}

	/**
	 * 设置单个零件序列号。
	 * 
	 * @param materialSns
	 *            the materialSns to set
	 */
	public void setMaterialSns(String materialSns) {
		this.materialSns = materialSns;
	}

	/**
	 * 获取部门编号。
	 * 
	 * @return the deptUid
	 */
	
	public String getDeptUid() {
		return deptUid;
	}

	/**
	 * 设置部门编号。
	 * 
	 * @param deptUid
	 *            the deptUid to set
	 */
	public void setDeptUid(String deptUid) {
		this.deptUid = deptUid;
	}

	/**
	 * 获取部门。
	 * 
	 * @return the dept
	 */
	public Dept getDept() {
		return dept;
	}

	/**
	 * 设置部门。
	 * 
	 * @param dept
	 *            the dept to set
	 */
	public void setDept(Dept dept) {
		this.dept = dept;
	}

	/**
	 * 获取检验员印章。
	 * 
	 * @return the checkerPrint
	 */
	
	public String getCheckerPrint() {
		return checkerPrint;
	}

	/**
	 * 设置检验员印章。
	 * 
	 * @param checkerPrint
	 *            the checkerPrint to set
	 */
	public void setCheckerPrint(String checkerPrint) {
		this.checkerPrint = checkerPrint;
	}

	/**
	 * 获取交库日期。
	 * 
	 * @return the intoWarehouseDate
	 */
	
	public Date getIntoWarehouseDate() {
		return intoWarehouseDate;
	}

	/**
	 * 设置交库日期。
	 * 
	 * @param intoWarehouseDate
	 *            the intoWarehouseDate to set
	 */
	public void setIntoWarehouseDate(Date intoWarehouseDate) {
		this.intoWarehouseDate = intoWarehouseDate;
	}

	/**
	 * 获取零件型别。
	 * 
	 * @return the partStyle
	 */
	
	public String getPartStyle() {
		return partStyle;
	}

	/**
	 * 设置零件型别。
	 * 
	 * @param partStyle
	 *            the partStyle to set
	 */
	public void setPartStyle(String partStyle) {
		this.partStyle = partStyle;
	}

	/**
	 * 获取产品型号。
	 * 
	 * @return the productPhase
	 */
	
	public String getProductPhase() {
		return productPhase;
	}

	/**
	 * 设置产品型号。
	 * 
	 * @param productPhase
	 *            the productPhase to set
	 */
	public void setProductPhase(String productPhase) {
		this.productPhase = productPhase;
	}

	/**
	 * 获取型别。
	 * 
	 * @return the model
	 */
	
	public String getModel() {
		return model;
	}

	/**
	 * 设置型别。
	 * 
	 * @param model
	 *            the model to set
	 */
	public void setModel(String model) {
		this.model = model;
	}

	/**
	 * 获取图号。
	 * 
	 * @return the drawingId
	 */
	
	public String getDrawingId() {
		return drawingId;
	}

	/**
	 * 设置图号。
	 * 
	 * @param drawingId
	 *            the drawingId to set
	 */
	public void setDrawingId(String drawingId) {
		this.drawingId = drawingId;
	}

	/**
	 * 获取零（组）件号。
	 * 
	 * @return the batchNum
	 */
	
	public String getBatchNum() {
		return batchNum;
	}

	/**
	 * 设置零（组）件号
	 * 
	 * @param batchNum
	 *            the batchNum to set
	 */
	public void setBatchNum(String batchNum) {
		this.batchNum = batchNum;
	}

	/**
	 * 获取零件名。
	 * 
	 * @return the partName
	 */
	
	public String getPartName() {
		return partName;
	}

	/**
	 * 设置零件名。
	 * 
	 * @param partName
	 *            the partName to set
	 */
	public void setPartName(String partName) {
		this.partName = partName;
	}

	/**
	 * 获取部门名。
	 * 
	 * @return the deptName
	 */
	
	public String getDeptName() {
		return deptName;
	}

	/**
	 * 设置部门名。
	 * 
	 * @param deptName
	 *            the deptName to set
	 */
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}

	/**
	 * 获取改变原因。
	 * 
	 * @return the changeReason
	 */
	public String getChangeReason() {
		return changeReason;
	}

	/**
	 * 设置改变原因。
	 * 
	 * @param changeReason
	 *            the changeReason to set
	 */
	public void setChangeReason(String changeReason) {
		this.changeReason = changeReason;
	}

	/**
	 * 获取重打印许可。
	 * 
	 * @return the reprintAllow
	 */
	public Boolean getReprintAllow() {
		return reprintAllow;
	}

	/**
	 * 设置重打印许可。
	 * 
	 * @param reprintAllow
	 *            the reprintAllow to set
	 */
	public void setReprintAllow(Boolean reprintAllow) {
		this.reprintAllow = reprintAllow;
	}

	/**
	 * 获取零件版本。
	 * 
	 * @return the productVersion
	 */
	
	public String getProductVersion() {
		return productVersion;
	}

	/**
	 * 设置零件版本。
	 * 
	 * @param productVersion
	 *            the productVersion to set
	 */
	public void setProductVersion(String productVersion) {
		this.productVersion = productVersion;
	}

	/**
	 * 获取原材料批次号。
	 * 
	 * @return the materialBatchNum
	 */
	
	public String getMaterialBatchNum() {
		return materialBatchNum;
	}

	/**
	 * 设置原材料批次号。
	 * 
	 * @param materialBatchNum
	 *            the materialBatchNum to set
	 */
	public void setMaterialBatchNum(String materialBatchNum) {
		this.materialBatchNum = materialBatchNum;
	}

	/**
	 * 获取技术单编号。
	 * 
	 * @return the technicalBillId
	 */
	
	public String getTechnicalBillId() {
		return technicalBillId;
	}

	/**
	 * 设置技术单编号。
	 * 
	 * @param technicalBillId
	 *            the technicalBillId to set
	 */
	public void setTechnicalBillId(String technicalBillId) {
		this.technicalBillId = technicalBillId;
	}

	/**
	 * 获取客户编号。
	 * 
	 * @return the customerUid
	 */
	
	public String getCustomerUid() {
		return customerUid;
	}

	/**
	 * 设置客户编号。
	 * 
	 * @param customerUid
	 *            the customerUid to set
	 */
	public void setCustomerUid(String customerUid) {
		this.customerUid = customerUid;
	}

	/**
	 * 获取零件任务。
	 * 
	 * @return the partTask
	 */
	public PartTask getPartTask() {
		return partTask;
	}

	/**
	 * 设置零件任务。
	 * 
	 * @param partTask
	 *            the partTask to set
	 */
	public void setPartTask(PartTask partTask) {
		this.partTask = partTask;
	}

	/**
	 * 获取返修表头。
	 * 
	 * @return the repairheader
	 */
	public Repair getRepair() {
		return repair;
	}

	/**
	 * 设置返修表头。
	 * 
	 * @param repairheader
	 * the repairheader to set
	 */
	public void setRepair(Repair repair) {
		this.repair = repair;
	}

	/**
	 * 获取客户名。
	 * 
	 * @return the customer
	 */
//	public Partner getCustomer() {
//		return customer;
//	}

	/**
	 * 设置客户名。
	 * 
	 * @param customer
	 *            the customer to set
	 */
//	public void setCustomer(Partner customer) {
//		this.customer = customer;
//	}

	/**
	 * 获取创建者。
	 * 
	 * @return the creator
	 */
	public Employee getCreator() {
		return creator;
	}

	/**
	 * 设置创建者。
	 * 
	 * @param creator
	 *            the creator to set
	 */
	public void setCreator(Employee creator) {
		this.creator = creator;
	}

	public String getSubMaterialRepUid() {
		return subMaterialRepUid;
	}

	public void setSubMaterialRepUid(String subMaterialRepUid) {
		this.subMaterialRepUid = subMaterialRepUid;
	}

	public String getReplaceMaterial() {
		return replaceMaterial;
	}

	public void setReplaceMaterial(String replaceMaterial) {
		this.replaceMaterial = replaceMaterial;
	}

	public String getAttatchRef() {
		return attatchRef;
	}

	public void setAttatchRef(String attatchRef) {
		this.attatchRef = attatchRef;
	}

	public String getCheckDeptName() {
		return checkDeptName;
	}

	public void setCheckDeptName(String checkDeptName) {
		this.checkDeptName = checkDeptName;
	}

	public String getSupplyState() {
		return supplyState;
	}

	public void setSupplyState(String supplyState) {
		this.supplyState = supplyState;
	}

	public String getCheckDeptUid() {
		return checkDeptUid;
	}

	public void setCheckDeptUid(String checkDeptUid) {
		this.checkDeptUid = checkDeptUid;
	}

	public String getTechStandardId() {
		return techStandardId;
	}

	public void setTechStandardId(String techStandardId) {
		this.techStandardId = techStandardId;
	}

	public String getPcCheckResult() {
		return pcCheckResult;
	}

	public void setPcCheckResult(String pcCheckResult) {
		this.pcCheckResult = pcCheckResult;
	}

	public String getCertificateType() {
		return certificateType;
	}

	public void setCertificateType(String certificateType) {
		this.certificateType = certificateType;
	}

	public String getCheckerName() {
		return checkerName;
	}

	public void setCheckerName(String checkerName) {
		this.checkerName = checkerName;
	}

	public String getProductIssue() {
		return productIssue;
	}

	public void setProductIssue(String productIssue) {
		this.productIssue = productIssue;
	}

	public String getTechCondition() {
		return techCondition;
	}

	public void setTechCondition(String techCondition) {
		this.techCondition = techCondition;
	}

	public String getCustomerRepresent() {
		return customerRepresent;
	}

	public void setCustomerRepresent(String customerRepresent) {
		this.customerRepresent = customerRepresent;
	}

	public Date getLastPrintTime() {
		return lastPrintTime;
	}

	public void setLastPrintTime(Date lastPrintTime) {
		this.lastPrintTime = lastPrintTime;
	}

	public String getUseState() {
		return useState;
	}

	public void setUseState(String useState) {
		this.useState = useState;
	}

	public String getPartUid() {
		return partUid;
	}

	public void setPartUid(String partUid) {
		this.partUid = partUid;
	}

	public String getDesignReplaceBillNumber() {
		return designReplaceBillNumber;
	}

	public void setDesignReplaceBillNumber(String designReplaceBillNumber) {
		this.designReplaceBillNumber = designReplaceBillNumber;
	}

	public String getTechVersion() {
		return techVersion;
	}

	public void setTechVersion(String techVersion) {
		this.techVersion = techVersion;
	}

	public String getPartstyleStandard() {
		return partstyleStandard;
	}

	public void setPartstyleStandard(String partstyleStandard) {
		this.partstyleStandard = partstyleStandard;
	}

	public Long getPlanQty() {
		return planQty;
	}

	public void setPlanQty(Long planQty) {
		this.planQty = planQty;
	}

	public Long getSubmitCheckQty() {
		return submitCheckQty;
	}

	public void setSubmitCheckQty(Long submitCheckQty) {
		this.submitCheckQty = submitCheckQty;
	}

	public Long getFirstCheckGoodQty() {
		return firstCheckGoodQty;
	}

	public void setFirstCheckGoodQty(Long firstCheckGoodQty) {
		this.firstCheckGoodQty = firstCheckGoodQty;
	}

	public String getCoCheckerPrint() {
		return coCheckerPrint;
	}

	public void setCoCheckerPrint(String coCheckerPrint) {
		this.coCheckerPrint = coCheckerPrint;
	}

	public String getContactId() {
		return contactId;
	}

	public void setContactId(String contactId) {
		this.contactId = contactId;
	}

	public String getUuid() {
		return uniqueId;
	}

	public void setUuid(String uuid) {
		this.uniqueId = uuid;
	}

	public String getUniqueId() {
		return uniqueId;
	}

	public void setUniqueId(String uniqueId) {
		this.uniqueId = uniqueId;
	}
	

}
